<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/26/026
 * Time: 10:31
 */

namespace App\Controller;


use App\Model\CommentModel;
use App\Model\UserModel;
use lib\View;

class CommentController
{
   public function  send_comment(){
       $senderinfo=$_POST;
       unset($senderinfo['example']);
       $senderinfo['create_at']=date('y-m-d h:i:s',time());
       $comment=new CommentModel('comment','cid');

//      // print_r($senderinfo);exit();
      if ($comment->save($senderinfo)){
          $user=new UserModel('user','uid');
          $comments=$user->join(['comment'=>'uid']);
          $_SESSION['comments']=$comments;
          echo '<script>alert("评论成功");history.back();</script>';
      }

   }
}